Option Strict On
Option Explicit On

'Copyright (c) 2007-2010, William Severance, Jr., WESNet Designs
'All rights reserved.

'Redistribution and use in source and binary forms, with or without modification, are permitted
'provided that the following conditions are met:

'Redistributions of source code must retain the above copyright notice, this list of conditions
'and the following disclaimer.

'Redistributions in binary form must reproduce the above copyright notice, this list of conditions
'and the following disclaimer in the documentation and/or other materials provided with the distribution.

'Neither the name of William Severance, Jr. or WESNet Designs may be used to endorse or promote
'products derived from this software without specific prior written permission.

'Disclaimer: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
'            OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
'            AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE
'            FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
'            LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
'            INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
'            OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
'            IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

'Although I will try to answer questions regarding the installation and use of this software when
'such questions are submitted via e-mail to the below address, no promise of further
'support or enhancement is made nor should be assumed.

'Developer Contact Information:
'     William Severance, Jr.
'     WESNet Designs
'     679 Upper Ridge Road
'     Bridgton, ME 04009
'     Phone: 207-647-9375
'     E-Mail: bill@wesnetdesigns.com
'     Website: www.wesnetdesigns.com

Imports System
Imports DotNetNuke

Namespace WESNet.DNN.Modules.EPrayer

    ''' -----------------------------------------------------------------------------
    ''' <summary>
    ''' An abstract class for the data access layer
    ''' </summary>
    ''' -----------------------------------------------------------------------------
    Public MustInherit Class DataProvider

#Region "Shared/Static Methods"

        ' singleton reference to the instantiated object 
        Private Shared objProvider As DataProvider = Nothing

        ' constructor
        Shared Sub New()
            CreateProvider()
        End Sub

        ' dynamically create provider
        Private Shared Sub CreateProvider()
            objProvider = CType(Framework.Reflection.CreateObject("data", "WESNet.DNN.Modules.EPrayer", ""), DataProvider)
        End Sub

        ' return the provider
        Public Shared Shadows Function Instance() As DataProvider
            Return objProvider
        End Function

#End Region

#Region "Abstract methods"

#Region "Categories"
        Public MustOverride Function GetCategories(ByVal ModuleID As Integer) As IDataReader
        Public MustOverride Function GetCategory(ByVal CategoryID As Integer) As IDataReader
        Public MustOverride Sub AddCategory(ByVal objCategory As CategoryInfo)
        Public MustOverride Sub DeleteCategory(ByVal CategoryID As Integer)
        Public MustOverride Sub UpdateCategory(ByVal objCategory As CategoryInfo)
#End Region

#Region "Stati"
        Public MustOverride Function GetStati() As IDataReader
        Public MustOverride Function GetStatus(ByVal StatusID As Integer) As IDataReader
        Public MustOverride Sub AddStatus(ByVal objStatus As StatusInfo)
        Public MustOverride Sub DeleteStatus(ByVal StatusID As Integer)
        Public MustOverride Sub UpdateStatus(ByVal objStatus As StatusInfo)
#End Region

#Region "Relationships"
        Public MustOverride Function GetRelationships() As IDataReader
        Public MustOverride Function GetRelationship(ByVal RelationshipID As Integer) As IDataReader
        Public MustOverride Sub AddRelationship(ByVal objRelationship As RelationshipInfo)
        Public MustOverride Sub DeleteRelationship(ByVal RelationshipID As Integer)
        Public MustOverride Sub UpdateRelationship(ByVal objRelationship As RelationshipInfo)
#End Region

#Region "ChurchRelationships"
        Public MustOverride Function GetChurchRelationships() As IDataReader
        Public MustOverride Function GetChurchRelationship(ByVal ChurchRelationshipID As Integer) As IDataReader
        Public MustOverride Sub AddChurchRelationship(ByVal objChurchRelationship As ChurchRelationshipInfo)
        Public MustOverride Sub DeleteChurchRelationship(ByVal ChurchRelationshipID As Integer)
        Public MustOverride Sub UpdateChurchRelationship(ByVal objChurchRelationship As ChurchRelationshipInfo)
#End Region

#Region "Distributions"
        Public MustOverride Function GetDistributions(ByVal ModuleID As Integer) As IDataReader
        Public MustOverride Function GetDistribution(ByVal DistributionID As Integer) As IDataReader
        Public MustOverride Sub AddDistribution(ByVal objDistribution As DistributionInfo)
        Public MustOverride Sub DeleteDistribution(ByVal DistributionID As Integer)
        Public MustOverride Sub UpdateDistribution(ByVal objDistribution As DistributionInfo)
#End Region

#Region "Requests"
        Public MustOverride Function GetRequests(ByVal ModuleID As Integer, ByVal Distributions As Integer, ByVal Filter As String, ByVal IncludeExpired As Boolean, ByVal OrderBy As String, ByVal UserID As Integer, ByVal PageSize As Integer, ByVal PageIndex As Integer) As IDataReader
        Public MustOverride Function GetRequest(ByVal RequestID As Integer, ByVal UserID As Integer, ByVal HydratePosts As Boolean) As IDataReader
        Public MustOverride Sub UpdateRequest(ByVal objRequest As RequestInfo)
        Public MustOverride Sub UpdateRequestStatus(ByVal RequestID As Integer, ByVal StatusID As Integer, ByVal Expires As DateTime, ByVal IsLocked As Boolean)
        Public MustOverride Sub IncrementRequestViews(ByVal RequestID As Integer)
        Public MustOverride Function GetNewRequests(ByVal ModuleID As Integer, ByVal DaysForNew As Integer, ByVal MaxRows As Integer, ByVal UserID As Integer) As IDataReader
        Public MustOverride Function GetExpiredRequests(ByVal ModuleID As Integer, ByVal Filter As String, ByVal OrderBy As String, ByVal UserID As Integer, ByVal PageSize As Integer, ByVal PageIndex As Integer) As IDataReader
#End Region

#Region "Posts"
        Public MustOverride Function GetPosts(ByVal RequestID As Integer, ByVal Distributions As Integer, ByVal GetOnlyUpdates As Boolean) As IDataReader
        Public MustOverride Function GetPost(ByVal PostID As Integer) As IDataReader
        Public MustOverride Function AddPost(ByVal objRequest As RequestInfo, ByVal objPost As PostInfo, _
                                             ByVal CreatedByUserID As Integer, ByVal CreatedOnDate As DateTime, _
                                             ByVal LastModifiedByUserID As Integer, ByVal LastModifiedOnDate As DateTime) As Integer
        Public MustOverride Sub UpdatePost(ByVal objPost As PostInfo, ByVal UserID As Integer)
        Public MustOverride Sub DeletePost(ByVal PostID As Integer)
        Public MustOverride Function GetNewUpdates(ByVal ModuleID As Integer, ByVal DaysForNew As Integer, ByVal MaxRows As Integer, ByVal UserID As Integer) As IDataReader
        Public MustOverride Function GetMyPosts(ByVal ModuleID As Integer, ByVal UserID As Integer, ByVal OrderBy As String, ByVal PageSize As Integer, ByVal PageIndex As Integer) As IDataReader
        Public MustOverride Sub ClearNotifySubject(ByVal PostID As Integer)
#End Region

#Region "Moderators"
        Public MustOverride Function IsModerator(ByVal ModuleID As Integer, ByVal UserID As Integer) As Boolean
        Public MustOverride Function GetModerator(ByVal ModuleID As Integer, ByVal UserID As Integer) As IDataReader
        Public MustOverride Function GetModerators(ByVal ModuleID As Integer, ByVal GetActiveOnly As Boolean) As IDataReader
        Public MustOverride Sub AddModerator(ByVal ModuleID As Integer, ByVal UserID As Integer, ByVal ExpiresDate As DateTime)
        Public MustOverride Sub UpdateModerator(ByVal ModuleID As Integer, ByVal UserID As Integer, ByVal ExpiresDate As DateTime, ByVal IsSuspended As Boolean)
        Public MustOverride Sub DeleteModerator(ByVal ModuleId As Integer, ByVal UserID As Integer)
        Public MustOverride Function GetModeratorEmails(ByVal PostID As Integer) As IDataReader
#End Region

#Region "Moderatation"
        Public MustOverride Function GetPostsToModerate(ByVal ModuleID As Integer) As IDataReader
        Public MustOverride Sub ModerateApprovePost(ByVal PostID As Integer, ByVal ApprovedBy As Integer)
        Public MustOverride Sub ModerateRejectPost(ByVal PostID As Integer, ByVal RejectedBy As Integer)
        Public MustOverride Sub ModerateUnapprovePost(ByVal PostID As Integer, ByVal UnapprovedBy As Integer)
#End Region

#Region "Users"
        Public MustOverride Sub IncrementUserVisits(ByVal ModuleID As Integer, ByVal UserID As Integer)
        Public MustOverride Function GetUsers(ByVal ModuleId As Integer, ByVal Filter As String, ByVal OrderBy As String, _
                                              ByVal PageSize As Integer, ByVal PageIndex As Integer) As IDataReader
        Public MustOverride Function GetUser(ByVal ModuleID As Integer, ByVal UserID As Integer) As IDataReader
        Public MustOverride Function GetUser(ByVal ModuleID As Integer, ByVal [Alias] As String) As IDataReader
        Public MustOverride Sub AddUser(ByVal ModuleId As Integer, ByVal UserID As Integer, ByVal [Alias] As String, ByVal PageSize As Integer, ByVal OrderBy As String, _
                                        ByVal MailFormat As DotNetNuke.Services.Mail.MailFormat, ByVal ViewableDistributions As Integer, ByVal IsTrusted As Boolean)
        Public MustOverride Sub UpdateUser(ByVal objUser As UserInfo)
        Public MustOverride Sub DeleteUser(ByVal ModuleID As Integer, ByVal UserID As Integer)
#End Region

#Region "Tracking"
        Public MustOverride Sub StartEndRequestTracking(ByVal RequestID As Integer, ByVal UserID As Integer, ByVal Start As Boolean)
        Public MustOverride Sub StartEndAllPostsTracking(ByVal ModuleID As Integer, ByVal UserID As Integer, ByVal Start As Boolean)
        Public MustOverride Function GetTrackingEmails(ByVal PostID As Integer) As IDataReader
#End Region

#Region "MasterModules and Agregators"
        Public MustOverride Function GetAvailableMasterModules(ByVal PortalID As Integer, ByVal AgregatorModuleID As Integer) As IDataReader
        Public MustOverride Sub SaveAgregators(ByVal AgregatorModuleID As Integer, ByVal MasterModuleIds As String)
#End Region

#Region "Stats"
        Public MustOverride Sub InitializeStats(ByVal ModuleID As Integer)
        Public MustOverride Function GetStats(ByVal ModuleID As Integer) As IDataReader
        Public MustOverride Sub RefreshStats(ByVal ModuleID As Integer)
        Public MustOverride Sub UpdateStats(ByVal ModuleID As Integer, ByVal Requests As Integer, ByVal Updates As Integer, _
                                              ByVal MostRecentRequestID As Integer, ByVal MostRecentPostID As Integer, _
                                              ByVal MostRecentAuthorID As Integer, ByVal MostRecentPostDate As DateTime, _
                                              ByVal PostsToModerate As Integer)
        Public MustOverride Sub UpgradeStats(ByVal ModuleID As Integer)

#End Region

#End Region

    End Class

End Namespace